/**
 * interface.h
 * bushaofeng 2013.1.28
 * LogicServer api基类
 */

#ifndef __INTERFACE_H_
#define __INTERFACE_H_

#include <iostream>
#include "bs_type.h"
#include "mongo/client/dbclient.h"
#include "mongo/bson/bson.h"
#include "mongo/db/json.h"

using namespace std;
using namespace mongo;

class Interface{
    public:
        Interface(){
            m_users = "test.users";
            m_follows = "test.follows";
            m_fans = "test.fans";
            m_topics = "test.topics";
            m_posts = "test.posts";
            m_locations = "test.locations";
            m_inbox = "test.inbox";
        }
        /**
         * 添加user的关注
         */
        virtual state_t addFollow(string user, string follow) = 0;
        /**
         * 获取user的关注列表
         */
        virtual BSONObj getFollows(string user, int start, int num) = 0;
        /**
         * 删除user的关注
         */
        virtual state_t delFollow(string user, string follow) = 0;
        /**
         * 添加user的粉丝（一个人的好友关系为2个表，我的关注表，我的粉丝表即关注我的人）
         */
        virtual state_t addFan(string user, string fan) = 0;
        /**
         * 获取关注user的列表
         */
        virtual BSONObj getFans(string user, int start, int num) = 0;
        /**
         * 添加一个发表
         */
        virtual long long addTopic(BSONObj topic) = 0;
        /**
         * 获取user的发表
         */
        virtual BSONObj getTopics(string user, int start, int num) = 0;
        /**
         * 获取一个发表
         */
        virtual BSONObj getTopic(long long topic) = 0;
        /**
         * 获取评论
         */
        virtual BSONObj getPosts(string topic) = 0;
        /**
         * 获取user的位置列表
         */
        virtual BSONObj getLocations(string user, int start, int num) = 0;
        /**
         * 获取附近user
         */
        virtual BSONObj getNearUsers(double x, double y, int start, int num) = 0;
        /**
         * 获取附近发表
         */
        virtual BSONObj getNearTopics(double x, double y, int start, int num) = 0;
    protected:
        // 集合
        string  m_follows;
        string  m_users;
        string  m_fans;
        string  m_topics;
        string  m_posts;
        string  m_locations;
        string  m_inbox;
};

#endif
